package com.bawei.arouter

import android.util.Log
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.callback.NavigationCallback
import com.alibaba.android.arouter.launcher.ARouter

/**
 * 自定义页面跳转的单一降级策略
 */
class CustomNavigationCallBack constructor(private val path: String): NavigationCallback {

    /**
     * 匹配到目标页面
     */
    override fun onFound(postcard: Postcard?) {

    }

    /**
     * 没有匹配到目标页面
     */
    override fun onLost(postcard: Postcard?) {
        Log.e("CustomNavigation", "onLost:Target Page not found： " + postcard?.path)
        ARouter.getInstance().build(path).navigation()
    }

    /**
     * 到达目标页面
     */
    override fun onArrival(postcard: Postcard?) {

    }

    /**
     * 目标页面拦截
     */
    override fun onInterrupt(postcard: Postcard?) {

    }
}